package com.mycode.builder06.resolve;

//
public class HookActorController {

    // 逐步构建复杂产品对象
    public Actor construct(HookActorBuilder actorBuilder) {
        actorBuilder.buildType();
        actorBuilder.buildSex();
        actorBuilder.buildFace();
        actorBuilder.buildCostume();
        // 通过钩子方法来控制产品的构建
        if (actorBuilder.isBareheaded()) {
            actorBuilder.buildHairstyle();
        }
        Actor actor = actorBuilder.createActor();
        return actor;
    }
}
